import React, { Component } from 'react'
import PropTypes from 'prop-types'
export default class List extends Component {
  // static defaultProps = {}
  // static propTypes = {}
  render() {
    return (
      <ul>
        {this.props.list.map((item) => {
          return <li key={item.id}>{item.name}</li>
        })}
      </ul>
    )
  }
}
//props校验
List.propTypes = {
  list: PropTypes.array.isRequired,
}

//props默认
List.defaultProps = {
  list: [
    { name: '大傻子', id: 1 },
    { name: 'List要传递一个list属性', id: 2 },
    { name: 'list属性的值是数组哦', id: 3 },
  ],
}
